/*
 * @Author: lili
 * @Description:  首页接口
 */
import axios from './api';


// 首页
export let getHomeData = (page) =>{
    return axios.get(`/api/homepage?page=${page}`);
}

// 分类首页
export let getCateData = (cid) =>{
  return axios.get(`/api/homepage-cate-index?cid=${cid}`);
}

// 商品详情
export let getDetail = (id) =>{
  return axios.get(`/api/items/${id}`);
}

// 9块9
export let getNine = (id) =>{
  return axios.get('/api/homepage-cheap-goods');
}

// login
export let login = (params) =>{
  return axios.post('/api/auth/login-phone', params);
}

// 微信开放平台登录
// https://gitee.com/xiaomlove/huiyouduo-admin/wikis/微信开放平台登录
export const wechatLogin = (params) => {
  return axios.post('/api/auth/login-weixin-open', params);
}
// QQ互联登录
// params {"openid": "xxxxx", ...} 应包含 openid
export const qqLogin = (params) => {
  return axios.post('/api/auth/login-qq', params);
}

// 验证码
export let verifyCode = (params) =>{
  return axios.post('/api/auth/sms-verify-code', params);
}

// 更多热销
export let getMoreHot = () =>{
  return axios.get('/api/homepage-today-hot-order');
}

// 搜索
export let search = ({keywords, page, pageSize}) =>{
  return axios.get(`/api/homepage-super-search?keywords=${keywords}&page=${page}&pageSize=${pageSize}`);
}

// 收藏
export let collect = (params) =>{
  return axios.post('/api/collectAndViewhistory', params);
}

// 新消息
export let msg = () =>{
  return axios.get('api/user-push-message');
}

// 抽奖转盘
export let getPrize = (id) => {
  return axios.get(`/api/lucky-draw/${id}`);
}

// 抽奖转盘
export let actionPrize = (id) => {
  return axios.post(`/api/lucky-draw/action/${id}`);
}
 
// 商品优惠劵兑换
export let exchangeCoupon = (params) => {
  return axios.post('/api/items-exchange-counpon', params);
}